// (Physics: acceleration) Average acceleration is defined as the change of velocity 
// divided by the time taken to make the change, as shown in the following formula:
// a = （v1 - v0）/t
// Write a program that prompts the user to enter the starting velocity v0 in meters/
// second, the ending velocity v1 in meters/second, and the time span t in seconds, 
// and displays the average acceleration.

import java.util.Scanner;

public class test29 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        
        // 提示用户输入起始速度、结束速度和时间
        System.out.print("Enter starting velocity (v0) in m/s: ");
        double v0 = input.nextDouble();
        
        System.out.print("Enter ending velocity (v1) in m/s: ");
        double v1 = input.nextDouble();
        
        System.out.print("Enter time span (t) in seconds: ");
        double t = input.nextDouble();
        
        // 计算平均加速度：a = (v1 - v0) / t
        double acceleration = (v1 - v0) / t;
        
        // 显示结果，保留4位小数
        System.out.printf("The average acceleration is %.4f m/s²", acceleration);
        
        // 关闭Scanner
        input.close();
    }
}
